package com.hushan.elevator.service;

import com.hushan.elevator.model.DeviceInfo;
import com.hushan.elevator.model.DeviceType;
import com.hushan.elevator.model.User;
import org.springframework.data.domain.PageRequest;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Author: zzy
 * @Date: 2024/10/22 22:53
 * @Title:
 * @Version:
 * @Package: com.hushan.elevator.service
 */
public interface DeviceInfoService {
    boolean detectAuthorize(Integer id);

    boolean detectAuthorize(int userId, Integer id);

    boolean detectAuthorize(User user, Integer id);

    DeviceInfo findById(Integer id);

    void update(DeviceInfo deviceInfo);

    void add(DeviceInfo deviceInfo);

    void delete(Integer id);

    int findCountByDept(int id);

    int findOnlineCountByDept(boolean online,int id);

    List<DeviceInfo> findByDeptId(int id);

    /**
     * find device in this dept and all child dept
     * @param id deptId
     * @return List<DeviceInfo>
     */
    List<DeviceInfo> findChildDeptDeviceByDeptId(int id);
    List<DeviceInfo> findChildDeptDeviceByDeptId(Integer deptId, PageRequest pageRequest);

    List<DeviceInfo> findOnlineByDeptId(int id);

    DeviceInfo findBySerialNumb(String deviceSerial);

    DeviceType findTypeById(int deviceId);
    DeviceType findType(DeviceInfo info);
    int[] findCountInDept(Integer deptId);

    List<DeviceType> findTypes();

    List<DeviceInfo> findAll();

    void online(String devid, boolean b);
}